package com.zhengdongzulin.zuke.app.main.mine.waterAndElectricityMeter

import android.text.TextUtils
import androidx.fragment.app.Fragment
import com.google.gson.Gson
import com.lxj.androidktx.core.getVM
import com.lxj.androidktx.core.sp
import com.zhengdongzulin.zuke.R
import com.zhengdongzulin.zuke.app.data.ChangeHomeData
import com.zhengdongzulin.zuke.base.BaseActivity
import com.zhengdongzulin.zuke.databinding.ZkActivityWAEBinding

/**
 * 账单
 */
class ZKWAEMActivity : BaseActivity<WAEMVm, ZkActivityWAEBinding>() {

    var mTitles = arrayOf("我的电表", "我的水表")
    var mFragments = arrayListOf<Fragment>()

    lateinit var mChangeHomeData: ChangeHomeData

    override fun getLayoutResId(): Int = R.layout.zk_activity_w_a_e

    override fun initVM(): WAEMVm = getVM(WAEMVm::class.java)

    override fun initView() {
        setTitleContent("水电表")
        mFragments.add(ZKWAEMFragment.newInstance(ZKWAEMFragment.Type.ELECTRICITY))
        mFragments.add(ZKWAEMFragment.newInstance(ZKWAEMFragment.Type.WATER))
    }

    override fun initData() {
        if (!TextUtils.isEmpty(sp().getString("change_home", ""))) {
            mChangeHomeData =
                Gson().fromJson(sp().getString("change_home", ""), ChangeHomeData::class.java)
            mView.tlTitle.setViewPager(mView.vpFragment, mTitles, this, mFragments)
            mView.tlTitle.onPageSelected(0)
        }
    }

    override fun initListener() {
    }

    override fun startObserve() {

    }

}